package connexionsBdd;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;


public class Mysql {


	private static  Connection connect;
	private String url ="jdbc:mysql://localhost/tpcommandes";
	private String login = "tpcommandes";
	private String pass = "123456";

	private Mysql()
	{
		try 
		{
			Class.forName("com.mysql.jdbc.Driver");
			connect = DriverManager.getConnection(url, login, pass);
		} 
		catch (SQLException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
	
	public static Connection getInstance(){
		if(connect == null){
			new Mysql();
		}
		return connect;	
	}
}
